<template>
  <div>
    <div class="page-title">问题查询</div>
    <div class="page-content">
      <el-form
        :inline="true"
        :model="filterQuery"
        @submit.native.prevent="handleSearch"
        label-position="right"
        label-width="80px"
      >
        <el-row>
          <el-col>
            <el-form-item label="被检单位">
              <treeselect
                :multiple="false"
                :options="options"
                placeholder="请选择受检单位"
                v-model="filterQuery.companyCode"
                style="width: 280px"
                :searchable="false"
              />
            </el-form-item>
            <el-form-item label="检查日期">
              <el-date-picker
                v-model="dateRange"
                type="daterange"
                align="right"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                style="width: 280px"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="监督员 ">
              <el-select
                style="width: 280px"
                v-model="filterQuery.checkStaffID"
                placeholder="选择监督员"
                filterable
                clearable
              >
                <el-option
                  v-for="item in supervisors"
                  :key="item.employeeID"
                  :label="item.name"
                  :value="item.employeeID"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="问题状况">
              <el-select
                style="width: 280px"
                v-model="filterQuery.status"
                placeholder="选择状况"
                clearable
              >
                <el-option
                  v-for="item in status"
                  :key="item.id"
                  :label="item.name"
                  :value="item.name"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="监督轮次">
              <el-input
                placeholder="输入轮次"
                v-model="filterQuery.round"
                style="width: 280px"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <!-- <el-form-item label="问题状况" v-if=" userCode!=='2009'"> -->
            <el-form-item label="问题程度" v-if="userCode !== '2009'">
              <el-select
                style="width: 280px"
                v-model="filterQuery.problemRank"
                placeholder="选择程度"
                clearable
              >
                <el-option
                  v-for="item in ranks"
                  :key="item.id"
                  :label="item.name"
                  :value="item.name"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="问题原因" v-if="userCode !== '2009'">
              <el-select
                style="width: 280px"
                v-model="filterQuery.problemSource"
                placeholder="选择原因"
                clearable
              >
                <el-option
                  v-for="item in problemSources"
                  :key="item.id"
                  :label="item.name"
                  :value="item.name"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="问题类型" v-if="userCode !== '2009'">
              <el-select
                style="width: 280px"
                v-model="filterQuery.problemType"
                placeholder="选择类型"
                clearable
              >
                <el-option
                  v-for="item in types"
                  :key="item.id"
                  :label="item.hazardFactor"
                  :value="item.hazardFactor"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="岗位工龄" v-if="userCode !== '2009'">
              <el-select
                style="width: 280px"
                v-model="filterQuery.workingAge"
                placeholder="选择工龄"
                clearable
              >
                <el-option
                  v-for="item in ages"
                  :key="item.id"
                  :label="item.name"
                  :value="item.name"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="违章人员" v-if="userCode !== '2009'">
              <el-select
                style="width: 280px"
                v-model="filterQuery.responsePersonID"
                placeholder="选择人员"
                filterable
                clearable
              >
                <el-option
                  v-for="item in employees"
                  :key="item.employeeID"
                  :label="item.name"
                  :value="item.employeeID"
                ></el-option>
              </el-select>
            </el-form-item>
            <!--el-form-item label="监督轮次" v-if=" userCode!=='2009'">
              <el-input placeholder="输入轮次" v-model="filterQuery.round" style="width:280px"></el-input>
            </el-form-item-->

            <el-form-item label="用工性质" v-if="userCode !== '2009'">
              <el-select
                style="width: 280px"
                v-model="filterQuery.employmentProperty"
                placeholder="选择性质"
                clearable
              >
                <el-option
                  v-for="item in eproperties"
                  :key="item.id"
                  :label="item.name"
                  :value="item.name"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="岗位" v-if="userCode !== '2009'">
              <el-select
                style="width: 280px"
                v-model="filterQuery.workingName"
                placeholder="选择岗位"
                clearable
              >
                <el-option
                  v-for="item in names"
                  :key="item.id"
                  :label="item.name"
                  :value="item.name"
                ></el-option>
              </el-select>
            </el-form-item>
            <!--el-form-item label="问题状态" v-if=" userCode!=='2009'">
              <el-select style="width:280px" v-model="filterQuery.problemStatus" placeholder="选择问题状态" clearable>
                <el-option v-for="item in problemStatus" :key="item.id" :label="item.name" :value="item.name"></el-option>
              </el-select>
            </el-form-item-->
          </el-col>
        </el-row>

        <el-row>
          <el-col>
            <el-form-item>
              <el-button
                type="primary"
                native-type="submit"
                icon="el-icon-search"
                >查询</el-button
              >
            </el-form-item>
            <el-form-item>
              <el-button
                style="background-color: #3399cc; color: #ffffff; width: 100%"
                @click="export2Excel"
                >导出Excel</el-button
              >
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <el-table
        :data="tableData"
        v-loading="loading"
        border
        @row-click="clickTable"
        ref="refTable"
        style="width: 1600px"
        height="500"
        max-height="500"
      >
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form
              label-position="left"
              inline
              class="demo-table-expand"
              label-width="140px"
            >
              <el-row>
                <el-col :span="7">
                  <el-form-item label="受检单位：">{{
                    props.row.parentCompanyName
                  }}</el-form-item>
                </el-col>
                <el-col :span="7">
                  <el-form-item label="受检基层单位：">{{
                    props.row.basicCompanyName
                  }}</el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="7">
                  <el-form-item label="检查时间：">{{
                    props.row.checkDate
                  }}</el-form-item>
                </el-col>
                <el-col :span="17">
                  <el-form-item label="受检三级单位">{{
                    props.row.companyName
                  }}</el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="7">
                  <el-form-item label="检查地点：">{{
                    props.row.checkStation
                  }}</el-form-item>
                </el-col>
                <el-col :span="17">
                  <el-form-item label="检查项目：">{{
                    props.row.checkItem
                  }}</el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="17">
                  <el-form-item label="检查表：">{{
                    props.row.checkListName
                  }}</el-form-item>
                </el-col>
              </el-row>

              <el-row :span="24">
                <el-col :span="24">
                  <el-form-item label="检查项：">{{
                    props.row.checkListItemName
                  }}</el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="24">
                  <el-form-item label="问题描述：">{{
                    props.row.description
                  }}</el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="7">
                  <el-form-item label="安全绩效扣分:">{{
                    props.row.lostScore
                  }}</el-form-item>
                </el-col>
                <el-col :span="17">
                  <el-form-item label="问题原因：">{{
                    props.row.problemSource
                  }}</el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label="依据标准：">{{
                    props.row.problemGist
                  }}</el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label="问题体系要素：">{{
                    props.row.hseFactor
                  }}</el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="7">
                  <el-form-item label="问题程度：">{{
                    props.row.problemRank
                  }}</el-form-item>
                </el-col>
                <el-col :span="17">
                  <el-form-item label="问题类型：">{{
                    props.row.problemType
                  }}</el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="7">
                  <el-form-item label="责任人：">{{
                    props.row.responsePersonName
                  }}</el-form-item>
                </el-col>
                <el-col :span="17">
                  <el-form-item label="岗位名称：">{{
                    props.row.workingName
                  }}</el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="7">
                  <el-form-item label="用工性质：">{{
                    props.row.employmentProperty
                  }}</el-form-item>
                </el-col>
                <el-col :span="17">
                  <el-form-item label="岗位工龄：">{{
                    props.row.workingAge
                  }}</el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="24">
                  <el-form-item label="整改责任人：">{{
                    props.row.supervisorName
                  }}</el-form-item>
                </el-col>
              </el-row>

              <el-form-item label="问题附件："></el-form-item>
              <el-row>
                <el-col :span="2">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="width: 90%; height: 240px"
                    v-if="props.row.checkAttach1 !== ''"
                  >
                    <el-popover placement="right" title="" trigger="click">
                      <div style="max-width: 600px; height: auto">
                        <img
                          :src="props.row.checkAttach1"
                          style="max-width: 600px; height: auto"
                        />
                      </div>
                      <img
                        slot="reference"
                        :src="props.row.checkAttach1"
                        :alt="props.row.checkAttach1"
                        style="max-height: 240px"
                      /> </el-popover
                    ><br />
                  </el-card>
                </el-col>
                <el-col :span="2">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="width: 90%; height: 240px"
                    v-if="props.row.checkAttach2 !== ''"
                  >
                    <el-popover placement="right" title="" trigger="click">
                      <div style="max-width: 600px; height: auto">
                        <img
                          :src="props.row.checkAttach2"
                          style="max-width: 600px; height: auto"
                        />
                      </div>
                      <img
                        slot="reference"
                        :src="props.row.checkAttach2"
                        :alt="props.row.checkAttach2"
                        style="max-height: 240px"
                      /> </el-popover
                    ><br />
                  </el-card>
                </el-col>
                <el-col :span="2">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="width: 90%; height: 240px"
                    v-if="props.row.checkAttach3 !== ''"
                  >
                    <el-popover placement="right" title="" trigger="click">
                      <div style="max-width: 600px; height: auto">
                        <img
                          :src="props.row.checkAttach3"
                          style="max-width: 600px; height: auto"
                        />
                      </div>
                      <img
                        slot="reference"
                        :src="props.row.checkAttach3"
                        :alt="props.row.checkAttach3"
                        style="max-height: 240px"
                      /> </el-popover
                    ><br />
                  </el-card>
                </el-col>
                <el-col :span="2">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="width: 90%; height: 240px"
                    v-if="props.row.checkAttach4 !== ''"
                  >
                    <el-popover placement="right" title="" trigger="click">
                      <div style="max-width: 600px; height: auto">
                        <img
                          :src="props.row.checkAttach4"
                          style="max-width: 600px; height: auto"
                        />
                      </div>
                      <img
                        slot="reference"
                        :src="props.row.checkAttach4"
                        :alt="props.row.checkAttach4"
                        style="max-height: 240px"
                      /> </el-popover
                    ><br />
                  </el-card>
                </el-col>
                <el-col :span="2">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="width: 90%; height: 240px"
                    v-if="props.row.checkVideo !== ''"
                  >
                    <video width="100%" height="230" controls>
                      <source :src="props.row.checkVideo" type="video/mp4" />
                    </video>
                  </el-card>
                </el-col>
              </el-row>

              <div
                v-for="(itemy, i) in props.row.children"
                :key="i"
                id="recDiv"
              >
                <div v-if="itemy.rectDate !== ''">
                  <div style="height: 30px"></div>
                  <hr />
                  <div style="height: 20px"></div>
                  <el-row>
                    <el-col :span="7">
                      <el-form-item label="整改时间:" id="rda">{{
                        itemy.rectDate
                      }}</el-form-item>
                    </el-col>
                    <el-col :span="17">
                      <el-form-item label="整改效果:">{{
                        itemy.rectEffect
                      }}</el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                    <el-col :span="7">
                      <el-form-item label="整改责任人：">{{
                        itemy.supervisorName
                      }}</el-form-item>
                    </el-col>
                    <el-col :span="17">
                      <el-form-item label="整改描述:">{{
                        itemy.rectDescription
                      }}</el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="整改文档:"
                        ><a
                          :href="itemy.rectFile"
                          target="_blank"
                          rel="noopener noreferrer"
                          >{{ itemy.rectFile }}</a
                        ></el-form-item
                      >
                    </el-col>
                  </el-row>

                  <el-form-item label="整改附件："></el-form-item>
                  <el-row>
                    <el-col :span="2">
                      <el-card
                        :body-style="{ padding: '10px' }"
                        style="width: 90%; height: 240px"
                        v-if="itemy.rectAttach1 !== ''"
                      >
                        <el-popover placement="right" title="" trigger="click">
                          <div style="max-width: 600px; height: auto">
                            <img
                              :src="itemy.rectAttach1"
                              style="max-width: 600px; height: auto"
                            />
                          </div>
                          <img
                            slot="reference"
                            :src="itemy.rectAttach1"
                            :alt="itemy.rectAttach1"
                            style="max-height: 240px"
                          /> </el-popover
                        ><br />
                      </el-card>
                    </el-col>
                    <el-col :span="2">
                      <el-card
                        :body-style="{ padding: '10px' }"
                        style="width: 90%; height: 240px"
                        v-if="itemy.rectAttach2 !== ''"
                      >
                        <el-popover placement="right" title="" trigger="click">
                          <div style="max-width: 600px; height: auto">
                            <img
                              :src="itemy.rectAttach2"
                              style="max-width: 600px; height: auto"
                            />
                          </div>
                          <img
                            slot="reference"
                            :src="itemy.rectAttach2"
                            :alt="itemy.rectAttach2"
                            style="max-height: 240px"
                          /> </el-popover
                        ><br />
                      </el-card>
                    </el-col>
                    <el-col :span="2">
                      <el-card
                        :body-style="{ padding: '10px' }"
                        style="width: 90%; height: 240px"
                        v-if="itemy.rectAttach3 !== ''"
                      >
                        <el-popover placement="right" title="" trigger="click">
                          <div style="max-width: 600px; height: auto">
                            <img
                              :src="itemy.rectAttach3"
                              style="max-width: 600px; height: auto"
                            />
                          </div>
                          <img
                            slot="reference"
                            :src="itemy.rectAttach3"
                            :alt="itemy.rectAttach3"
                            style="max-height: 240px"
                          /> </el-popover
                        ><br />
                      </el-card>
                    </el-col>
                    <el-col :span="2">
                      <el-card
                        :body-style="{ padding: '10px' }"
                        style="width: 90%; height: 240px"
                        v-if="itemy.rectAttach4 !== ''"
                      >
                        <el-popover placement="right" title="" trigger="click">
                          <div style="max-width: 600px; height: auto">
                            <img
                              :src="itemy.rectAttach4"
                              style="max-width: 600px; height: auto"
                            />
                          </div>
                          <img
                            slot="reference"
                            :src="itemy.rectAttach4"
                            :alt="itemy.rectAttach4"
                            style="max-height: 240px"
                          /> </el-popover
                        ><br />
                      </el-card>
                    </el-col>
                    <el-col :span="2">
                      <el-card
                        :body-style="{ padding: '10px' }"
                        style="width: 90%; height: 240px"
                        v-if="itemy.rectVideo !== ''"
                      >
                        <video width="100%" height="230" controls>
                          <source :src="itemy.rectVideo" type="video/mp4" />
                        </video>
                      </el-card>
                    </el-col>
                  </el-row>
                </div>
              </div>

              <el-row>
                <el-col :span="7">
                  <el-form-item label="验证人：">{{
                    props.row.verifyPersonName
                  }}</el-form-item>
                </el-col>
                <el-col :span="17">
                  <el-form-item label="验证时间：">{{
                    props.row.verifyDate
                  }}</el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </template>
        </el-table-column>

        <el-table-column
          label="轮次"
          prop="round"
          header-align="center"
          width="60px"
        >
        </el-table-column>
        <el-table-column
          label="日期"
          prop="checkDate"
          header-align="center"
          width="100px"
        >
        </el-table-column>
        <el-table-column
          label="单位"
          prop="parentCompanyName"
          header-align="center"
          width="100px"
        >
        </el-table-column>
        <el-table-column
          label="基层单位"
          prop="basicCompanyName"
          header-align="center"
          width="100px"
        >
        </el-table-column>
        <el-table-column
          label="班组"
          prop="companyName"
          header-align="center"
          width="110px"
        >
        </el-table-column>
        <el-table-column
          label="检查地点"
          prop="checkStation"
          header-align="center"
          width="80px"
        >
        </el-table-column>
        <el-table-column
          label="检查类型"
          prop="checkType"
          header-align="center"
          width="80px"
        >
        </el-table-column>
        <el-table-column
          label="问题类型"
          prop="problemType"
          header-align="center"
          width="150px"
        >
        </el-table-column>
        <el-table-column
          label="问题体系要素"
          prop="hseFactor"
          header-align="center"
          width="110px"
        >
        </el-table-column>
        <el-table-column
          label="问题原因"
          prop="problemSource"
          header-align="center"
          width="100px"
        >
        </el-table-column>
        <el-table-column label="问题描述" header-align="center" width="200px">
          <template slot-scope="scope">
            <span>{{ scope.row.description | ellipsis }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="整改责任人"
          prop="supervisorName"
          header-align="center"
          width="100px"
        >
        </el-table-column>
        <!-- 改 -->
        <el-table-column
          label="责任人职位"
          prop="station"
          header-align="center"
          width="100px"
        >
        </el-table-column>
        <el-table-column
          label="检查人"
          prop="checkPerson"
          header-align="center"
          width="80px"
        >
        </el-table-column>
        <el-table-column
          label="问题程度"
          prop="problemRank"
          header-align="center"
          width="80px"
        >
        </el-table-column>
        <el-table-column
          label="违章人员"
          prop="responsePersonName"
          header-align="center"
          width="80px"
        >
        </el-table-column>
        <el-table-column
          label="岗位"
          prop="workingName"
          header-align="center"
          width="110px"
        >
        </el-table-column>
        <el-table-column
          label="岗位工作年限"
          prop="workingAge"
          header-align="center"
          width="110px"
        >
        </el-table-column>
        <el-table-column
          label="用工形式"
          prop="employmentProperty"
          header-align="center"
          width="80px"
        >
        </el-table-column>
        <el-table-column
          label="安全绩效扣分"
          prop="lostScore"
          header-align="center"
          width="120px"
        >
        </el-table-column>
        <el-table-column
          label="问题状况"
          prop="status"
          header-align="center"
          width="80px"
        >
        </el-table-column>
        <el-table-column
          label="操作"
          v-if="userCode !== '2009'"
          header-align="center"
          width="120px"
        >
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.status == '未整改'"
              type="warning"
              size="mini"
              icon="el-icon-edit"
              @click="handleEdit(scope.row)"
            ></el-button>
            <el-button
              v-else
              disabled
              type="warning"
              size="mini"
              icon="el-icon-edit"
            >
            </el-button>
            <el-button
              type="danger"
              size="mini"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
            ></el-button>
          </template>
        </el-table-column>
      </el-table>

      <div class="pagination-base">
        <el-pagination
          @current-change="handlePageChange"
          :current-page="filterQuery.pageIdx"
          :page-size="filterQuery.pageSize"
          :total="total"
          background
          layout="total, prev, pager, next, jumper"
        >
        </el-pagination>
      </div>

      <!--修改-->
      <el-dialog
        title="问题详情"
        :visible.sync="editVisibleDialog"
        center
        width="1200px"
        :showClose="false"
        :close-on-click-modal="false"
      >
        <div style="height: 50vh; overflow: auto">
          <el-form
            label-width="140px"
            :model="editForm"
            style="width: 90%"
            :rules="editFormRules"
          >
            <el-row>
              <el-col :span="12">
                <el-form-item label="检查人员：">
                  <el-input
                    v-model="editForm.checkStaffName"
                    style="width: 100%"
                    readonly
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检查日期：">
                  <el-date-picker
                    v-model="editForm.checkDate"
                    style="width: 100%"
                    type="date"
                    value-format="yyyy-MM-dd"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="受检单位：">
                  <treeselect
                    :multiple="false"
                    :options="options"
                    placeholder="请选择受检单位"
                    v-model="editForm.companyCode"
                    @select="changeCompany"
                    :searchable="true"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检查类型：">
                  <el-select
                    style="width: 100%"
                    v-model="editForm.checkType"
                    placeholder="选择类型"
                    clearable
                  >
                    <el-option
                      v-for="item in checkTypes"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="问题描述：">
              <el-input
                v-model="editForm.problemDescription"
                style="width: 100%"
                type="textarea"
                :autosize="{ minRows: 4 }"
              ></el-input>
            </el-form-item>
            <el-form-item label="备注：">
              <el-input
                v-model="editForm.note"
                style="width: 100%"
                type="textarea"
                :autosize="{ minRows: 2 }"
              ></el-input>
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="问题类型：">
                  <el-input
                    v-model="editForm.problemType"
                    style="width: 100%"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="问题程度：">
                  <el-select v-model="editForm.problemRank" style="width: 100%">
                    <el-option
                      v-for="item in ranks"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="问题体系要素：">
                <el-input v-model="editForm.hseFactor"></el-input>
              </el-form-item>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="问题原因：">
                  <el-input
                    v-model="editForm.problemSource"
                    style="width: 100%"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="安全绩效扣分：">
                  <el-select v-model="editForm.lostScore" style="width: 100%">
                    <el-option
                      v-for="item in scoreOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="依据标准：">
              <el-input
                v-model="editForm.problemGist"
                style="width: 100%"
                type="textarea"
                :autosize="{ minRows: 1 }"
              ></el-input>
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="责任人：" prop="responsePersonID">
                  <el-select
                    v-model="editForm.responsePersonID"
                    placeholder="输入姓名搜索"
                    style="width: 100%"
                    filterable
                    clearable
                  >
                    <el-option
                      v-for="item in responsePersonOptions"
                      :key="item.employeeID"
                      :label="item.name + '(' + item.companyName + ' | ' + item.station + ')'"
                      :value="item.employeeID"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="用工性质：">
                  <el-input
                    v-model="editForm.employmentProperty"
                    style="width: 100%"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="岗位工龄：">
                  <el-select v-model="editForm.workingAge" style="width: 100%">
                    <el-option
                      v-for="item in ages"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="岗位名称：">
                  <el-select
                    style="width: 100%"
                    v-model="editForm.workingName"
                    placeholder="选择岗位"
                    clearable
                  >
                    <el-option
                      v-for="item in names"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="整改责任人：" prop="supervisorID">
                  <el-select
                    v-model="editForm.supervisorID"
                    placeholder="输入姓名搜索"
                    style="width: 100%"
                    filterable
                    clearable
                  >
                    <el-option
                      v-for="item in supervisorOptions"
                      :key="item.employeeID"
                      :label="item.name + '(' + item.companyName + ' | ' + item.station + ')'"
                      :value="item.employeeID"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="检查图片：">
                <el-upload
                  :action="`/api/file_upload`"
                  :on-preview="beforeAttachUpload"
                  :on-remove="handleRemoveUpdateCheckAttach"
                  :file-list="updateCheckAttachFileList"
                  :on-success="updateSuccessCheckAttach"
                  :limit="4"
                  list-type="picture"
                >
                  <el-button type="primary" size="small">点击上传</el-button>
                  <span v-if="!editForm.checkAttach1">暂无检查图片！</span>
                  <div slot="tip" class="el-upload__tip">
                    最多上传4张图片，每张图片不能超过12MB！
                  </div>
                </el-upload>
              </el-form-item>
            </el-row>
            <el-row>
              <el-form-item label="问题视频：">
                <el-row>
                  <el-col :span="8">
                    <el-upload
                      v-model="editForm.checkVideo"
                      :action="`/api/file_upload`"
                      :auto-upload="true"
                      :limit="1"
                      :headers="{ Authorization: currentUser.token }"
                      accept=".mp4, .qlv, .qsv, .ogg, .flv, .avi, .wmv, .rmvb"
                      :before-upload="beforeAttachUpload"
                      :on-remove="UpdateRemoveCheckVideo"
                      :on-success="UpdateSuccessCheckVideo"
                      list-type="text"
                    >
                      <el-button size="small" type="primary"
                        >点击上传</el-button
                      >
                      <div slot="tip" style="padding-right: 20px">
                        只能上传mp4、avi、flash、rmvb、rm格式，且不大于12M的视频。
                      </div>
                    </el-upload>
                  </el-col>
                  <el-col :span="16">
                    <el-card
                      :body-style="{ padding: '10px' }"
                      style="width: 400px; height: 200px; text-align: center"
                    >
                      <span v-if="!editForm.checkVideo">未上传视频文件！</span>
                      <video
                        v-else-if="editForm.checkVideo"
                        width="100%"
                        height="180"
                        controls
                        preload="none"
                        :src="editForm.checkVideo"
                      ></video>
                      <video
                        v-else
                        width="100%"
                        height="180"
                        controls
                        preload="none"
                        :src="updateCheckVideoUrl"
                      ></video>
                    </el-card>
                  </el-col>
                </el-row>
              </el-form-item>
            </el-row>
          </el-form>
        </div>
        <div slot="footer" class="dialog-footer" style="text-align: right">
          <el-button type="primary" @click="submitEdit">确定</el-button>
          <el-button type="danger" @click="editVisibleDialog = false"
            >返回</el-button
          >
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import {
  GetDictionary,
  // GetEmployee,
  GetSupervisor2,
  GetProblemType,
  GetAdminCode,
} from "../../../services/cq_gettreedata";
// import { DeleteProblem } from "../../../services/cq_gettreedata";
import { GetProblemList1 } from "../../../services/cq_gettreedata";
// import Treeselect from "@riophae/vue-treeselect";
//import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { GetCompany } from "../../../services/cq_gettreedata";
// import serviceDialog from "./detail_edit";
import {
  DeleteCheckRecord,
  UpdateCheckRecord,
  GetEmployees,
} from "../../../services/cpProblemList";
import { GetCurrentUser } from "../../../store/CurrentUser";

const DefaultQuery = {
  //taskName: '',
  companyCode: null,
  checkDate1: "",
  checkDate2: "",
  // problemRepeat: '',
  round: "",
  checkStaffID: "",
  responsePersonID: "",
  problemType: "",
  problemRank: "",
  hseFactor: "",
  workingName: "",
  workingAge: "",
  // problemStatus:'',
  employmentProperty: "",
  problemSources: "",
  status: "",
  pageIdx: 1,
  pageSize: 10,
};
const DefaultQueryExcel = {
  //taskName: '',
  companyCode: null,
  checkDate1: "",
  checkDate2: "",
  round: "",
  checkStaffID: "",
  responsePersonID: "",
  problemSources: "",
  problemType: "",
  problemRank: "",
  hseFactor: "",
  workingName: "",
  workingAge: "",
  // problemStatus:'',
  employmentProperty: "",
  status: "",
  // pageIdx: 1,
  // pageSize: 10,
  type: "all",
};

export default {
  filters: {
    ellipsis(value) {
      if (!value) return "";
      if (value.length > 30) {
        return value.slice(0, 30) + "...";
      }
      return value;
    },
  },

  data() {
    return {
      showDialog: false,
      dataToDialog: {},
      pid: 0,
      filterQuery: {},
      fitertask: {},
      taskAyy: "",
      taskNameList: [],
      taskNameList1: [],
      loading: false,
      tableData: [],
      timeout: null,
      dateRange: [],
      total: 0,
      options: [],
      types: [],
      employees: [],
      repeats: [],
      status: [],
      indexStartNum: 1,
      ranks: [],
      factors: [],
      rounds: [],
      supervisors: [],
      ages: [],
      names: [],
      eproperties: [],
      recHis: [],
      rectFile: [],
      problemSources: [],
      userCode: 0,
      // filterQueryExcel: {}
      editVisibleDialog: false,
      editForm: {
        address: "",
        basicCompanyName: "",
        // checkCompanyList: [],
        checkDate: "",
        checkItem: "",
        checkListID: "",
        checkListItemCode: "",
        checkListItemName: "",
        checkListName: "",
        checkRecordID: "",
        checkRecordNo: "",
        checkStaffID: "",
        checkStaffName: "",
        checkType: "",
        checkVideo: "",
        companyCode: "",
        companyName: "",
        education: "",
        employmentProperty: "",
        hseFactor: "",
        immediately: "",
        lostScore: "",
        method: "editProblem",
        note: "",
        parentCompanyName: "",
        penalty: "",
        problemDescription: "",
        problemGist: "",
        problemRank: "",
        problemSource: "",
        problemType: "",
        rectEffect: "",
        responsePersonID: "",
        responsePersonName: "",
        status: "",
        supervisionTaskCode: "",
        supervisionTaskDetail2ID: "",
        supervisorID: "",
        supervisorName: "",
        type: "",
        verifyDate: "",
        verifyPersonEmpID: "",
        verifyPersonName: "",
        workingAge: "",
        workingName: "",
      },
      editFormRules: {},
      scoreOptions: [],
      checkTypes: [],
      responsePersonOptions: [],
      supervisorOptions: [],
      updateCheckAttachFileList: [],
      updateCheckVideoUrl: "",
    };
  },

  mounted() {
    this.loadFilterParams();
    this.getUserCode();
    this.gettaskName();
    this.handleGetListData();
    this.getDate();
    this.getTypes();
    // this.getrepeats()
    this.getStatusDict();
    //this.handleDelete()
    this.getRanks();
    this.getFactors();
    this.getRounds();
    this.getSupervisors();
    this.getAges();
    this.getNames();
    this.getEproperties();
    this.getEmployees();
    this.getSource();
  },
  computed: {
    currentUser() {
      return GetCurrentUser();
    },
  },
  methods: {
    queryListQ() {
      this.handleSearch();
    },
    // cancelDialog(val) {
    //   this.dataToDialog = {};
    //   this.showDialog = val;
    // },
    // submitDialog(val) {
    //   this.dataToDialog = {};
    //   this.showDialog = val;
    // },

    getDialogVdateReffect() {
      let date = new Date();
      let month =
        date.getMonth() < 9 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
      let day = date.getDate() <= 9 ? "0" + date.getDate() : date.getDate();
      this.dataToDialog.verifyDate =
        date.getFullYear() + "-" + month + "-" + day;
      this.dataToDialog.rectEffect = "合格";
    },
    // editProblem(row, method) {
    //   this.dataToDialog = row;
    //   this.dataToDialog.method = method;
    //   this.dataToDialog.checkCompanyList = new Object(
    //     this.dealCompanyCode(row.companyCode)
    //   );
    //   if (this.dataToDialog.immediately == "否") this.getDialogVdateReffect();
    //   this.showDialog = true;
    //   //console.log(this.dataToDialog);
    // },
    dealCompanyCode(companyCode) {
      let checkCompanyList = [];
      let i = 0;
      while (i < companyCode.length) {
        checkCompanyList.push(companyCode.slice(0, i + 2));
        i = i + 2;
      }
      return checkCompanyList;
    },

    getUserCode() {
      GetAdminCode()
        .then((res) => {
          this.userCode = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    getSource() {
      GetDictionary({ name: "问题原因" })
        .then((res) => {
          this.problemSources = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    handleGetRechistory(res) {
      // debugger
      for (var i = 0; i < res.data.list.length; i++) {
        this.recHis[res.data.list[i].checkRecordID] = [];
        for (var j = 0; j < res.data.list.length; j++) {
          if (
            res.data.list[i].checkRecordID === res.data.list[j].checkRecordID
          ) {
            this.recHis[res.data.list[i].checkRecordID].push(res.data.list[j]);
          }
        }
      }
    },

    handleRecfile(res) {
      for (var i = 0; i < res.data.list.length; i++) {
        for (var j = 0; j < res.data.list[i].children.length; j++) {
          if (
            res.data.list[i].children[j].rectFile == null ||
            res.data.list[i].children[j].rectFile == undefined ||
            res.data.list[i].children[j].rectFile == ""
          ) {
            res.data.list[i].children[j].rectFile = "#";
          }
        }
      }
    },

    getEmployees() {
      GetEmployees()
        .then((res) => {
          this.employees = res.data;
          this.responsePersonOptions = res.data;
          this.supervisorOptions = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getRanks() {
      GetDictionary({ name: "隐患等级" })
        .then((res) => {
          this.ranks = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    getFactors() {
      GetDictionary({ name: "问题要素" })
        .then((res) => {
          this.factors = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    getRounds() {
      GetDictionary({ name: "监督轮次" })
        .then((res) => {
          this.rounds = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    getSupervisors() {
      GetSupervisor2()
        .then((res) => {
          this.supervisors = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    getAges() {
      GetDictionary({ name: "岗位工龄" })
        .then((res) => {
          this.ages = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    getNames() {
      GetDictionary({ name: "岗位" })
        .then((res) => {
          this.names = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getEproperties() {
      GetDictionary({ name: "员工组" })
        .then((res) => {
          this.eproperties = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },

    getTypes() {
      GetProblemType()
        .then((res) => {
          //debugger
          this.types = res.data;
        })
        .catch((err) => {
          //debugger
          this.$message.error(err.message);
        });
    },

    getStatusDict() {
      GetDictionary({ name: "问题状况", type: "all" })
        .then((res) => {
          this.status = res.data;
          this.status.splice(3);
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getDate() {
      GetCompany()
        .then((res) => {
          this.options = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    // handleDelete(item) {
    //   this.$confirm("此操作将永久删除该条记录, 是否继续?", "提示", {
    //     confirmButtonText: "确定",
    //     cancelButtonText: "取消",
    //     type: "warning",
    //   })
    //     .then(() => {
    //       DeleteProblem(item.id).then(
    //         () => {
    //           this.handleGetListData();
    //         },
    //         (err) => {
    //           this.$message.error(err.message);
    //         }
    //       );
    //     })
    //     .catch(() => {});
    // },
    export2Excel() {
      this.filterQueryExcel = { ...DefaultQueryExcel, ...this.$route.query };
      this.filterQueryExcel = {
        ...this.filterQueryExcel,
      };
      this.filterQueryExcel = JSON.parse(JSON.stringify(this.filterQuery));
      delete this.filterQueryExcel.pageIdx;
      delete this.filterQueryExcel.pageSize;
      this.filterQueryExcel.type = "all";
      this.excelData = GetProblemList1(this.filterQueryExcel).then((res) => {
        this.excelData = res.data;
        this.loading = false;
        require.ensure([], () => {
          const {
            export_json_to_excel,
          } = require("../../../vendor/Export2Excel");
          const tHeader = [
            "轮次",
            "日期",
            "单位",
            "基层单位",
            "班组",
            "检查地点",
            "检查类型",
            "问题类型",
            "问题体系要素",
            "问题原因",
            "问题描述",
            "整改责任人",
            "检查人",
            "问题程度",
            "违章人员",
            "岗位",
            "岗位工作年限",
            "用工形式",
            "安全绩效扣分",
            "问题状况",
          ];
          // 上面设置Excel的表格第一行的标题
          const filterVal = [
            "round",
            "checkDate",
            "parentCompanyName",
            "basicCompanyName",
            "companyName",
            "checkStation",
            "checkType",
            "problemType",
            "hseFactor",
            "problemSource",
            "description",
            "supervisorName",
            "checkPerson",
            "problemRank",
            "responsePersonName",
            "workingName",
            "workingAge",
            "employmentProperty",
            "lostScore",
            "status",
          ];
          // 上面的index、phone_Num、school_Name是tableData里对象的属性
          const list = this.excelData; //把data里的tableData存到list
          const data = this.formatJson(filterVal, list);
          export_json_to_excel(tHeader, data, "列表excel");
        });
      });
    },
    formatJson(filterVal, jsonData) {
      return jsonData.map((v) => filterVal.map((j) => v[j]));
    },
    gettaskName() {
      GetProblemList1(this.fitertask)
        .then((res) => {
          this.taskAyy = res.data.list;
          for (var i = 0; i < this.taskAyy.length; i++) {
            this.taskNameList1.push({ value: this.taskAyy[i].taskName });
          }
          var hash = {};
          this.taskNameList = this.taskNameList1.reduce(function (item, next) {
            hash[next.value]
              ? ""
              : (hash[next.value] = true && item.push(next));
            return item;
          }, []);
          this.loading = false;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    clickTable(row) {
      this.$refs.refTable.toggleRowExpansion(row);
    },
    handleSearch() {
      this.filterQuery.pageIdx = 1;
      this.handleGetListData();
    },
    checkFilterParams() {
      // debugger
      //datepicker range 绑定的数据是数组,需要拆成后端识别的2个参数
      if (this.dateRange && this.dateRange.length === 2) {
        this.filterQuery.checkDate1 = this.dateRange[0] + " " + "00:00:00";
        this.filterQuery.checkDate2 = this.dateRange[1] + " " + "23:59:59";
      } else {
        this.filterQuery.checkDate1 = "";
        this.filterQuery.checkDate2 = "";
      }
    },
    loadFilterParams() {
      //从query读取过滤条件
      this.filterQuery = { ...DefaultQuery, ...this.$route.query };
      //从query中取到的参数是string的,要转成element要求的number
      this.filterQuery = {
        ...this.filterQuery,
        pageIdx: parseInt(this.filterQuery.pageIdx, 10),
        pageSize: parseInt(this.filterQuery.pageSize, 10),
      };
      //填充datepicker range组件的内容
      if (this.filterQuery.checkDate1 && this.filterQuery.checkDate2) {
        this.dateRange = [
          this.filterQuery.checkDate1,
          this.filterQuery.checkDate2,
        ];
      }
    },
    querySearch(queryString, cb) {
      let results = queryString
        ? this.taskNameList.filter(this.createStateFilter(queryString))
        : this.taskNameList;
      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      }, 1000 * Math.random());
    },
    handleGetListData() {
      this.checkFilterParams();
      this.loading = true;
      //为了保存过滤条件,我们通过路由的history能力,更换url,从子页面返回的时候,能还原当前条件下的内容
      //this.$router.push({query: this.filterQuery})
      //接口函数,then后面的回调表示成功所执行的内容,catch后面表示错误时所执行的内容
      // this.filterQuery.round = this.filterQuery.round === "" ? 0 : +this.filterQuery.round
      //this.filterQuery.responsePersonID = 0
      // delete this.filterQuery.pageIdx
      // delete this.filterQuery.pageSize
      // debugger
      GetProblemList1(this.filterQuery)
        .then((res) => {
          // console.log("数据",res);
          this.handleGetRechistory(res);
          // this.handleRecfile(res)
          // console.log(this.recHis)
          // console.log(res.data.list)
          // console.log(typeof(res.data.list[0].children[0].rectFile))
          this.tableData = res.data.list;
          this.total = res.data.total;
          this.filterQuery.pageIdx = res.data.page;
          this.indexStartNum =
            (this.filterQuery.pageIdx - 1) * this.filterQuery.pageSize + 1;
          this.loading = false;
        })
        .catch((err) => {
          this.$message.error(err.message);
          this.loading = false;
        });
    },
    handlePageChange(page) {
      this.filterQuery.pageIdx = page;
      this.handleGetListData();
    },
    createStateFilter(queryString) {
      return (taskName) => {
        return (
          taskName.value.toLowerCase().indexOf(queryString.toLowerCase()) !== -1
        );
      };
    },
    getDictionary() {
      GetDictionary({ name: "扣分" })
        .then((res) => {
          this.scoreOptions = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
      GetDictionary({ name: "检查类型" })
        .then((res) => {
          this.checkTypes = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    handleEdit(row) {
      this.getDictionary();
      this.editVisibleDialog = true;
      console.log('row',row);
      this.editForm.basicCompanyName = row.basicCompanyName
      this.editForm.checkDate = row.checkDate
      this.editForm.checkItem = row.checkItem
      this.editForm.checkListID = row.checkListID
      this.editForm.checkListItemCode = row.checkListItemCode
      this.editForm.checkListItemName = row.checkListItemName
      this.editForm.checkListName = row.checkListName
      this.editForm.checkStaffName = row.checkPerson
      this.editForm.checkRecordNo = row.checkRecordNo
      this.editForm.checkStaffID = row.checkStaffID
      this.editForm.address = row.checkStation
      this.editForm.checkType = row.checkType
      this.editForm.checkVideo = row.checkVideo
      this.editForm.companyCode = row.companyCode
      this.editForm.companyName = row.companyName
      this.editForm.problemDescription = row.description
      this.editForm.education = row.education
      this.editForm.employmentProperty = row.employmentProperty
      this.editForm.hseFactor = row.hseFactor
      this.editForm.checkRecordID = row.id
      this.editForm.immediately = row.immediately
      this.editForm.lostScore = row.lostScore
      this.editForm.note = row.note
      this.editForm.parentCompanyName = row.parentCompanyName
      this.editForm.penalty = row.penalty
      this.editForm.problemGist = row.problemGist
      this.editForm.problemRank = row.problemRank
      this.editForm.problemSource = row.problemSource
      this.editForm.problemType = row.problemType
      this.editForm.rectEffect = row.rectEffect
      this.editForm.rectVideo = row.rectVideo
      this.editForm.rectFile = row.rectification
      this.editForm.responsePersonID = row.responsePersonID
      this.editForm.responsePersonName = row.responsePersonName
      this.editForm.status = row.status
      this.editForm.supervisionTaskCode = row.supervisionTaskCode
      this.editForm.supervisionTaskDetail2ID = row.supervisionTaskDetail2ID
      this.editForm.supervisorID = row.supervisorID
      this.editForm.supervisorName = row.supervisorName
      this.editForm.verifyDate = row.verifyDate
      this.editForm.verifyPersonEmpID = row.verifyPersonEmpID
      this.editForm.verifyPersonName = row.verifyPersonName
      this.editForm.workingAge = row.workingAge
      this.editForm.workingName = row.workingName
      this.getcheckAttach(row.checkAttach1);
      this.getcheckAttach(row.checkAttach2);
      this.getcheckAttach(row.checkAttach3);
      this.getcheckAttach(row.checkAttach4);
    },
    getcheckAttach(checkAttach) {
      if (checkAttach !== "") {
        var index = checkAttach.lastIndexOf("/");
        this.updateCheckAttachFileList.push({
          response: {
            data: checkAttach.substring(index + 1),
          },
          url: checkAttach,
        });
      }
    },
    handleDelete(row) {
      this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          DeleteCheckRecord(row.id)
            .then(() => {
              this.$message.success("删除成功！");
              this.handleGetListData();
            })
            .catch((err) => {
              this.$message.error(err);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    changeCompany(val) {
      this.editForm.companyCode = val.id
      this.editForm.companyName = val.label
    },
    beforeAttachUpload(file) {
      let size = file.size / 1024 / 1024 / 12;
      if (size > 1) {
        this.$message.error("上传文件大小不能超过12MB！");
      }
    },
    handleRemoveUpdateCheckAttach(file, fileList) {
      this.updateCheckAttachFileList = fileList;
    },
    updateSuccessCheckAttach(response, file, fileList) {
      if (response) {
        this.$notify.success({
          body: {
            style: { width: "300px", height: "500px" },
          },
          title: "提示",
          message: "文件上传成功",
        });
      }
      console.log(fileList);
      this.updateCheckAttachFileList = fileList;
    },
    UpdateRemoveCheckVideo() {
      this.editForm.checkVideo = "";
      this.updateCheckVideoUrl = "";
    },
    UpdateSuccessCheckVideo(response, file) {
      if (response) {
        this.$notify.success({
          body: {
            style: { width: "300px", height: "500px" },
          },
          title: "提示",
          message: "问题视频上传成功",
        });
        this.editForm.checkVideo = response.data;
        this.updateCheckVideoUrl = URL.createObjectURL(file.raw);
      }
    },
    submitEdit() {
      if (this.updateCheckAttachFileList.length == 0) {
        this.editForm.checkAttach1 = "";
        this.editForm.checkAttach2 = "";
        this.editForm.checkAttach3 = "";
        this.editForm.checkAttach4 = "";
        this.submitUpdate();
      } else {
        for (var i in this.updateCheckAttachFileList) {
          if (i == 0) {
            this.editForm.checkAttach1 = this.updateCheckAttachFileList[i].response.data;
            this.editForm.checkAttach2 = "";
            this.editForm.checkAttach3 = "";
            this.editForm.checkAttach4 = "";
          } else if (i == 1) {
            this.editForm.checkAttach2 = this.updateCheckAttachFileList[
              i
            ].response.data;
            this.editForm.checkAttach3 = "";
            this.editForm.checkAttach4 = "";
          } else if (i == 2) {
            this.editForm.checkAttach3 = this.updateCheckAttachFileList[
              i
            ].response.data;
            this.editForm.checkAttach4 = "";
          } else {
            this.editForm.checkAttach4 = this.updateCheckAttachFileList[
              i
            ].response.data;
          }
        }
        this.submitUpdate();
      }
    },
    submitUpdate() {
      console.log(this.editForm);
      UpdateCheckRecord(this.editForm.checkRecordID, this.editForm)
        .then(() => {
          this.$message.success("修改成功！");
          this.editVisibleDialog = false;
          this.updateCheckAttachFileList = [];
          this.updateCheckVideoUrl = "";
          this.handleGetListData();
        })
        .catch((err) => {
          this.$message.error(err);
        });
    },
  },
};
</script>
<style>
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}

.el-select-dropdown {
  max-width: 243px;
}
.el-select-dropdown__item {
  display: inline-block;
}
.el-select-dropdown__item span {
  min-width: 205px;
  display: inline-block;
}
</style>